precision mediump float;
uniform sampler2D uTexture;
varying vec2 vTexCoord;
uniform float uWidth;
uniform float uHeight;

void main() {
    vec2 texelSize = vec2(1.0 / uWidth, 1.0 / uHeight);
    float kernel[9] = float[](
        -1.0, -1.0, -1.0,
        -1.0,  8.0, -1.0,
        -1.0, -1.0, -1.0
    );
    vec4 sum = vec4(0.0);
    int index = 0;
    for (int x = -1; x <= 1; x++) {
        for (int y = -1; y <= 1; y++) {
            sum += texture2D(uTexture, vTexCoord + vec2(x, y) * texelSize) * kernel[index];
            index++;
        }
    }
    gl_FragColor = vec4(sum.rgb, 1.0);
}